package com.product;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.google.gson.Gson;
import com.product.pojo.Car;
import com.product.pojo.Ids;
import com.product.pojo.Radar;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.helpers.Loader;
import redis.clients.jedis.Jedis;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

import com.alibaba.fastjson2.JSONObject;


// 线程1  将雷达数据存进redis
// 线程2  将视频数据存进redis
// 线程3  雷视融合
// 线程4  清理过期的ids、carIds、radarIds
public class Main {

    // 为避免多线程出现问题，使用线程安全的ConcurrentHashMap类
    public static ConcurrentHashMap<String, String> ids1 = new ConcurrentHashMap<>();            //用于存储雷达ID和车辆车牌的对应关系，key为雷达ID，value为车辆车牌
    public static ConcurrentHashMap<String, Ids> carIds1 = new ConcurrentHashMap<>();            //用于存储车辆的ID和对应的车辆信息
    public static ConcurrentHashMap<String, Ids> radarIds1 = new ConcurrentHashMap<>();          //用于存储雷达的ID和对应的车辆信息
    public static ConcurrentHashMap<String, String> ids2 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds2 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds2 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids3 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds3 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds3 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids4 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds4 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds4 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids5 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds5 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds5 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids8 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds8 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds8 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids9 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds9 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds9 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids12 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds12 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds12 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, String> ids13 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> carIds13 = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Ids> radarIds13 = new ConcurrentHashMap<>();

    private static final int SUB = 200;


    // 视频的车道对应的雷达车道
    // jc07 雷达ip：3.1.2.61 视频devNo：37（外侧）36（内测）
    private static final int jc07Lane1 = 1;
    private static final int jc07Lane2 = 2;
    private static final String jc0712DevNo = "37";
    private static final int jc07Lane3 = 3;
    private static final int jc07Lane4 = 4;
    private static final String jc0734DevNo = "36";
    // jc05 雷达ip：3.1.2.62 视频devNo：34（外侧）35（内测）
    private static final int jc05Lane1 = 1;
    private static final int jc05Lane2 = 2;
    private static final String jc0512DevNo = "34";
    private static final int jc05Lane3 = 3;
    private static final int jc05Lane4 = 4;
    private static final String jc0534DevNo = "35";
    // jc03 雷达ip：3.1.2.63  视频devNo：6
    private static final int jc03Lane1 = 1;
    private static final int jc03Lane2 = 2;
    private static final String jc0312DevNo = "6";
    // jc08 雷达ip：3.1.2.64 视频devNo：5
    private static final int jc08Lane1 = 1;
    private static final int jc08Lane2 = 2;
    private static final String jc0812DevNo = "5";
    // jc01 雷达ip：3.1.2.65 视频devNo：7（快车道）8（慢车道）
    private static final int jc01Lane1 = 1;
    private static final int jc01Lane2 = 2;
    private static final String jc0112DevNo = "7";
    private static final int jc01Lane3 = 3;
    private static final int jc01Lane4 = 4;
    private static final String jc0134DevNo = "8";
    // jc06 雷达ip：3.1.2.68 视频devNo：25
    private static final int jc06Lane1 = 1;
    private static final int jc06Lane2 = 2;
    private static final String jc0612DevNo = "25";
    // jc11 雷达ip：3.1.2.69 视频devNo：9（雨棚摄像枪-X102前）10（雨棚摄像枪-X104前）11（雨棚摄像枪-X106前）
    private static final int jc11Lane1 = 1;
    private static final int jc11Lane2 = 2;
    private static final String jc1112DevNo = "11";
    private static final int jc11Lane3 = 3;
    private static final int jc11Lane4 = 4;
    private static final String jc1134DevNo = "10";
    private static final int jc11Lane5 = 5;
    private static final int jc11Lane6 = 6;
    private static final String jc1156DevNo = "9";
    // 15车道 雷达ip：3.1.2.71 视频devNo：16
//    private static final int jc12Lane1 = 0;
//    private static final int jc12Lane2 = 1;
    // 12车道（jc13） 雷达ip：3.1.2.72 视频devNo：14（雨棚X112）15（雨棚X114）
    private static final int jc13Lane1 = 1;
    private static final int jc13Lane2 = 2;
    private static final String jc1312DevNo = "15";
    private static final int jc13Lane3 = 3;
    private static final int jc13Lane4 = 4;
    private static final String jc1334DevNo = "14";
    // 8车道（jc14） 雷达ip：3.1.2.73 视频devNo：12（雨棚X108）13（雨棚X110）
    private static final int jc14Lane1 = 1;
    private static final int jc14Lane2 = 2;
    private static final String jc1412DevNo = "13";
    private static final int jc14Lane3 = 3;
    private static final int jc14Lane4 = 4;
    private static final String jc1434DevNo = "12";


    private static final int sleepTime = 60000;


//    private static BufferedWriter writer;
//
//    static {
//        try {
//            writer = new BufferedWriter(new FileWriter("car.txt"));
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//    }


    public static void main(String[] args) throws IOException {
        Loader.getResource("log4j.properties");
//        BasicConfigurator.configure();
        Logger logger = Logger.getLogger(Main.class);

//        Jedis j = new Jedis("127.0.0.1", 6379);
//        j.auth("jcgs2024");
//        j.flushAll();
        try (Jedis j = new Jedis("127.0.0.1", 6379)) {
            j.auth("jcgs2024");
            j.flushAll();
        } catch (Exception e) {
            LocalDateTime now = LocalDateTime.now();
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
            logger.error(now.format(formatter));
            logger.error("msg", e);
        }


        // 线程1_xx是获取ip为3.1.2.xx的雷达数据，存放到redis的(xx-60)号库的radar中
        Thread thread1_61 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.61";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1_61正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(1);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.61,jc07获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_61.start(); // 启动线程1_61
        Thread thread1_62 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.62";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1_62正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(2);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.62,jc05获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_62.start(); // 启动线程1_62
        Thread thread1_63 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.63";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1_63正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(3);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.63,jc03获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_63.start(); // 启动线程1_63
        Thread thread1_64 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.64";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(4);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.64,jc08获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_64.start(); // 启动线程1_64
        Thread thread1_65 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.65";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(5);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.65,jc01获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_65.start(); // 启动线程1_65
        Thread thread1_68 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.68";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(8);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.68,jc06获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_68.start(); // 启动线程1_68
        Thread thread1_69 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.69";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(9);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.69,jc11获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_69.start(); // 启动线程1_69

//        Thread thread1_71 = new Thread(() -> {
//            // 将雷达数据存进redis
//            //try (ResourceType resource = new ResourceType(args...)) {
//            //    // 代码块
//            //} catch (ExceptionType e) {
//            //    // 异常处理
//            //}
//            String url = "3.1.2.71";
//            int port = 1500;
//            while (true) {
//                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
//                    jedis.auth("jcgs2024");
////                    System.out.println("线程1正在运行中");
//                    byte[] recv = new byte[6844];
//                    radarSocket.getInputStream().read(recv);
//                    int start = 0;
//                    start += 4;
//                    // 数据长度
//                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
////                    if (length > 0)
////                        System.out.println("length=" + length);
//                    start += 2;
//                    // 数据类型
////                    String type = String.valueOf(recv[start]);
////                    System.out.println("type=" + type);
//                    start += 2;
//                    // 设备编号
////                    List<String> devId = new ArrayList<>();
////                    for (int i = start; i < start + 20; i++) {
////                        devId.add(String.valueOf(recv[i]));
////                    }
////                    System.out.println("devId=" + devId);
//                    start += 20;
//                    // 时间
////                    List<String> time = new ArrayList<>();
////                    for (int i = start; i < start + 6; i++) {
////                        time.add(String.valueOf(recv[i]));
////                    }
////                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
////                    System.out.println("time=" + time);
//                    start += 8;
//                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
//                    for (int i = 0; i < length; i++) {
//                        Radar radar = new Radar();
//                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setRoad(String.valueOf(recv[start]));
//                        start += 1;
//                        radar.setObjClass(String.valueOf(recv[start]));
//                        start += 1;
//                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
//                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
//                        start += 2;
////                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
////                        if (Float.isNaN(radar.getObjectRCS())) {
//                        radar.setObjectRCS(0);
////                        }
//                        start += 2;
//                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
//                        start += 4;
//
////                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
//                        start += 4;
//                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
//                        start += 4;
//                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
//                        start += 8;
////                        System.out.println(radar);
//                        jedis.select(11);
//                        jedis.rpush("radar", radar.toString());
////                        System.out.println(radar.toString());
////                        System.out.println(jedis.rpop("radar"));
//                    }
//                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    start += 4;
//
//                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
////                    Thread.sleep(100);
//                } catch (Exception e) {
//                    LocalDateTime now = LocalDateTime.now();
//                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//                    logger.error(now.format(formatter));
//                    logger.error("3.1.2.71,???获取数据时出现问题");
//                    logger.error("msg", e);
//                }
//            }
//        });
//        thread1_71.start(); // 启动线程1_71

        Thread thread1_72 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.72";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(12);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.72,jc13获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_72.start(); // 启动线程1_72

        Thread thread1_73 = new Thread(() -> {
            // 将雷达数据存进redis
            //try (ResourceType resource = new ResourceType(args...)) {
            //    // 代码块
            //} catch (ExceptionType e) {
            //    // 异常处理
            //}
            String url = "3.1.2.73";
            int port = 1500;
            while (true) {
                try (Jedis jedis = new Jedis("127.0.0.1", 6379); Socket radarSocket = new Socket(url, port);) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程1正在运行中");
                    byte[] recv = new byte[6844];
                    radarSocket.getInputStream().read(recv);
                    int start = 0;
                    start += 4;
                    // 数据长度
                    int length = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
//                    if (length > 0)
//                        System.out.println("length=" + length);
                    start += 2;
                    // 数据类型
//                    String type = String.valueOf(recv[start]);
//                    System.out.println("type=" + type);
                    start += 2;
                    // 设备编号
//                    List<String> devId = new ArrayList<>();
//                    for (int i = start; i < start + 20; i++) {
//                        devId.add(String.valueOf(recv[i]));
//                    }
//                    System.out.println("devId=" + devId);
                    start += 20;
                    // 时间
//                    List<String> time = new ArrayList<>();
//                    for (int i = start; i < start + 6; i++) {
//                        time.add(String.valueOf(recv[i]));
//                    }
//                    time.add(String.valueOf(ByteBuffer.wrap(recv, start + 6, 2).order(ByteOrder.LITTLE_ENDIAN).getShort()));
//                    System.out.println("time=" + time);
                    start += 8;
                    List<Map<String, Object>> radarClusterInfoARS = new ArrayList<>();
                    for (int i = 0; i < length; i++) {
                        Radar radar = new Radar();
                        radar.setSecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setMillisecond(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setId(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setRoad(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjClass(String.valueOf(recv[start]));
                        start += 1;
                        radar.setObjLength(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setObjWidth(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setOrientationAngle(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setX(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setY(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setxSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setySpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaXSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
                        radar.setaYSpeed(ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort());
                        start += 2;
//                        radar.setObjectRCS(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat());
//                        if (Float.isNaN(radar.getObjectRCS())) {
                        radar.setObjectRCS(0);
//                        }
                        start += 2;
                        radar.setLongitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLatitude(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setEvent(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;
                        radar.setLane(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getInt());
                        start += 4;

//                        radar.setObjectAltitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLatitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 4;
                        radar.setObjectLongitude(BigDecimal.valueOf(ByteBuffer.wrap(recv, start, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat()));
                        start += 8;
//                        System.out.println(radar);
                        jedis.select(13);
                        jedis.rpush("radar", radar.toString());
//                        System.out.println(radar.toString());
//                        System.out.println(jedis.rpop("radar"));
                    }
                    int crc = ByteBuffer.wrap(recv, start, 2).order(ByteOrder.LITTLE_ENDIAN).getShort();
                    start += 4;

                    int end = ByteBuffer.wrap(recv, start, 4).order(java.nio.ByteOrder.LITTLE_ENDIAN).getInt();
//                    Thread.sleep(100);
                } catch (Exception e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.73,jc14获取数据时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread1_73.start(); // 启动线程1_73


        // 车辆数据入redis库
        Thread thread2 = new Thread(() -> {
            // 将视频数据存进redis
            int aiPort = 60500;
            while (true) {
                try (DatagramSocket socket = new DatagramSocket(aiPort); Jedis jedis = new Jedis("127.0.0.1", 6379)) {
                    jedis.auth("jcgs2024");
//                    System.out.println("线程2正在运行中");
                    byte[] buffer = new byte[65535]; // 创建接收缓冲区
//                        System.out.println("正在循环中");
                    // 接收数据包
                    DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
                    socket.receive(packet);

                    // 获取数据并打印
                    String receivedData = new String(packet.getData(), 0, packet.getLength());
//                        System.out.println(receivedData);
                    if (!receivedData.contains("\"ChannelInfo\":null")) {
//                            System.out.println("notNull");
//                                System.out.println(receivedData);
//                                System.out.println(JSONToString.toString(receivedData));
                        try {
                            String strings = JSONToString.toString(receivedData);
//                            System.out.println(strings);
                            if (strings != null) {
                                for (String string : strings.split(";")) {
                                    if (string.split(",").length < 23)
                                        continue;
                                    String devNo = string.split(",")[20];
                                    String channelId = string.split(",")[15];
                                    // devNO=36或37为jc07外测和内测摄像机
                                    if (devNo.equals("37")) {
                                        jedis.select(1);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("36")) {
                                        jedis.select(1);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car3", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car4", string);
                                        }
                                    } else if (devNo.equals("34")) {
                                        jedis.select(2);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("35")) {
                                        jedis.select(2);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car3", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car4", string);
                                        }
                                    } else if (devNo.equals("6")) {
                                        jedis.select(3);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("5")) {
                                        jedis.select(4);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("7")) {
                                        jedis.select(5);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("8")) {
                                        jedis.select(5);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car3", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car4", string);
                                        }
                                    } else if (devNo.equals("25")) {
                                        jedis.select(8);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("11")) {
                                        jedis.select(9);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car2", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car1", string);
                                        }
                                    } else if (devNo.equals("10")) {
                                        jedis.select(9);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car4", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car3", string);
                                        }
                                    } else if (devNo.equals("9")) {
                                        jedis.select(9);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car6", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car5", string);
                                        }
                                    } else if (devNo.equals("14")) {
                                        jedis.select(12);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car1", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car2", string);
                                        }
                                    } else if (devNo.equals("15")) {
                                        jedis.select(12);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car3", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car4", string);
                                        }
                                    } else if (devNo.equals("12")) {
                                        jedis.select(13);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car4", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car3", string);
                                        }
                                    } else if (devNo.equals("13")) {
                                        jedis.select(13);
                                        if (channelId.equals("1")) {
                                            jedis.rpush("car2", string);
                                        } else if (channelId.equals("2")) {
                                            jedis.rpush("car1", string);
                                        }
                                    } else {
                                        // 透传
                                        sendJsonToLocalPort(receivedData);
                                    }
                                }
                            }
                        } catch (Exception e) {
                            LocalDateTime now = LocalDateTime.now();
                            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                            logger.error(now.format(formatter));
                            logger.error("msg", e);
//                            System.out.println("转换时出现问题");
                        }
//                                for (String string : JSONToString.toString(receivedData).split(";")) {
//                                    if (string.split(",")[15].equals("1")) {
//                                        jedis.rpush("car1", string);
//                                    } else if (string.split(",")[15].equals("2")) {
//                                        jedis.rpush("car2", string);
//                                    }
//                                }

//                            JSONToString.toString(receivedData);
//                            jedis.rpush("car", receivedData);
//                            System.out.println(jedis.rpop("car"));
                    }
//                            Thread.sleep(100);

                } catch (IOException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("获取AI数据时出现问题");
                    logger.error("msg", e);
                }
            }

        });
        thread2.start(); // 启动线程2


        Thread thread61 = new Thread(() -> {    // jc07 3.1.2.61  devNo:36,37
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(1);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc07Lane1 && Integer.parseInt(strs[20]) != jc07Lane2 && Integer.parseInt(strs[20]) != jc07Lane3 && Integer.parseInt(strs[20]) != jc07Lane4) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds1.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids1 = radarIds1.get(String.valueOf(radar.getId()));
//                        System.out.println(ids1);
                            Car car = carHaveId(radar, ids1, jc0712DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc07Lane1
                            if (radar.getLane() == jc07Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0712DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0712DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids1.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0712DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0712DevNo);
                                                    // 存radarId
                                                    ids1.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds1.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0712DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc07Lane2
                            else if (radar.getLane() == jc07Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0712DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0712DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids1.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0712DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0712DevNo);
                                                    // 存radarId
                                                    ids1.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds1.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0712DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc07Lane3
                            else if (radar.getLane() == jc07Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0734DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0734DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids1.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0734DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0734DevNo);
                                                    // 存radarId
                                                    ids1.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds1.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0734DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc07Lane4
                            else if (radar.getLane() == jc07Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0734DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0734DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids1.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0734DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0734DevNo);
                                                    // 存radarId
                                                    ids1.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds1.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0734DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0712DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids1.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids1.put(carStrs[5], carStrs[5]);
                                carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds1.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0712DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids1.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids1.put(carStrs[5], carStrs[5]);
                                carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds1.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0734DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids1.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids1.put(carStrs[5], carStrs[5]);
                                carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds1.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0734DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids1.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids1.put(carStrs[5], carStrs[5]);
                                carIds1.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds1.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.61,jc07融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread61.start();


        Thread thread62 = new Thread(() -> {    // jc05 3.1.2.62  devNo:34,35
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(2);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc05Lane1 && Integer.parseInt(strs[20]) != jc05Lane2 && Integer.parseInt(strs[20]) != jc05Lane3 && Integer.parseInt(strs[20]) != jc05Lane4) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds2.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids2 = radarIds2.get(String.valueOf(radar.getId()));
//                        System.out.println(ids2);
                            Car car = carHaveId(radar, ids2, jc0512DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc05Lane1
                            if (radar.getLane() == jc05Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0512DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0512DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids2.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0512DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0512DevNo);
                                                    // 存radarId
                                                    ids2.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds2.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0512DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc05Lane2
                            else if (radar.getLane() == jc05Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0512DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0512DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids2.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0512DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0512DevNo);
                                                    // 存radarId
                                                    ids2.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds2.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0512DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc05Lane3
                            else if (radar.getLane() == jc05Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0534DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0534DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids2.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0534DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0534DevNo);
                                                    // 存radarId
                                                    ids2.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds2.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0534DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc05Lane4
                            else if (radar.getLane() == jc05Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0534DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0534DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids2.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0534DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0534DevNo);
                                                    // 存radarId
                                                    ids2.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds2.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0534DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0512DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids2.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids2.put(carStrs[5], carStrs[5]);
                                carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds2.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0512DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids2.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids2.put(carStrs[5], carStrs[5]);
                                carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds2.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0534DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids2.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids2.put(carStrs[5], carStrs[5]);
                                carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds2.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0534DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids2.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids2.put(carStrs[5], carStrs[5]);
                                carIds2.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds2.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.62,jc05融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread62.start();

        Thread thread63 = new Thread(() -> {    // jc03 3.1.2.63  devNo:6
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(3);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc03Lane1 && Integer.parseInt(strs[20]) != jc03Lane2) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds3.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids3 = radarIds3.get(String.valueOf(radar.getId()));
//                        System.out.println(ids3);
                            Car car = carHaveId(radar, ids3, jc0312DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc03Lane1
                            if (radar.getLane() == jc03Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0312DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0312DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids3.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0312DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0312DevNo);
                                                    // 存radarId
                                                    ids3.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds3.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds3.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0312DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc03Lane2
                            else if (radar.getLane() == jc03Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0312DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0312DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids3.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0312DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0312DevNo);
                                                    // 存radarId
                                                    ids3.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds3.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds3.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0312DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0312DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids3.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids3.put(carStrs[5], carStrs[5]);
                                carIds3.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds3.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0312DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids3.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids3.put(carStrs[5], carStrs[5]);
                                carIds3.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds3.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.63,jc03融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread63.start();

        Thread thread64 = new Thread(() -> {    // jc08 3.1.2.64  devNo:5
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(4);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc08Lane1 && Integer.parseInt(strs[20]) != jc08Lane2) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds4.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids4 = radarIds4.get(String.valueOf(radar.getId()));
//                        System.out.println(ids4);
                            Car car = carHaveId(radar, ids4, jc0812DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc03Lane1
                            if (radar.getLane() == jc08Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0812DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0812DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids4.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0812DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0812DevNo);
                                                    // 存radarId
                                                    ids4.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds4.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds4.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0812DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc03Lane2
                            else if (radar.getLane() == jc08Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0812DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0812DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids4.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0812DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0812DevNo);
                                                    // 存radarId
                                                    ids4.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds4.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds4.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0812DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0812DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids4.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids4.put(carStrs[5], carStrs[5]);
                                carIds4.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds4.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0812DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids4.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids4.put(carStrs[5], carStrs[5]);
                                carIds4.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds4.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.64,jc08融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread64.start();


        Thread thread65 = new Thread(() -> {    // jc01 3.1.2.65  devNo:7,8
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(5);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc01Lane1 && Integer.parseInt(strs[20]) != jc01Lane2 && Integer.parseInt(strs[20]) != jc01Lane3 && Integer.parseInt(strs[20]) != jc01Lane4) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds5.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids5 = radarIds5.get(String.valueOf(radar.getId()));
//                        System.out.println(ids5);
                            Car car = carHaveId(radar, ids5, jc0112DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc01Lane1
                            if (radar.getLane() == jc01Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0112DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0112DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids5.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0112DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0112DevNo);
                                                    // 存radarId
                                                    ids5.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds5.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0112DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc01Lane2
                            else if (radar.getLane() == jc01Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0112DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0112DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids5.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0112DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0112DevNo);
                                                    // 存radarId
                                                    ids5.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds5.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0112DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc01Lane3
                            else if (radar.getLane() == jc01Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0134DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0134DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids5.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0134DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0134DevNo);
                                                    // 存radarId
                                                    ids5.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds5.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0134DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc01Lane4
                            else if (radar.getLane() == jc01Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0134DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0134DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids5.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0134DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0134DevNo);
                                                    // 存radarId
                                                    ids5.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds5.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0134DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0112DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids5.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids5.put(carStrs[5], carStrs[5]);
                                carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds5.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0112DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids5.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids5.put(carStrs[5], carStrs[5]);
                                carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds5.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0134DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids5.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids5.put(carStrs[5], carStrs[5]);
                                carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds5.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0134DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids5.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids5.put(carStrs[5], carStrs[5]);
                                carIds5.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds5.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.65,jc01融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread65.start();

        Thread thread68 = new Thread(() -> {    // jc06 3.1.2.68  devNo:25
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(8);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc06Lane1 && Integer.parseInt(strs[20]) != jc06Lane2) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds8.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids8 = radarIds8.get(String.valueOf(radar.getId()));
//                        System.out.println(ids8);
                            Car car = carHaveId(radar, ids8, jc0612DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc03Lane1
                            if (radar.getLane() == jc06Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0612DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc0612DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids8.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0612DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0612DevNo);
                                                    // 存radarId
                                                    ids8.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds8.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds8.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0612DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc03Lane2
                            else if (radar.getLane() == jc06Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc0612DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc0612DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids8.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc0612DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc0612DevNo);
                                                    // 存radarId
                                                    ids8.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds8.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds8.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc0612DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0612DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids8.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids8.put(carStrs[5], carStrs[5]);
                                carIds8.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds8.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc0612DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids8.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids8.put(carStrs[5], carStrs[5]);
                                carIds8.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds8.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.68,jc06融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread68.start();


        Thread thread69 = new Thread(() -> {    // jc11 3.1.2.69  devNo:9,10,11
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(9);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc11Lane1 && Integer.parseInt(strs[20]) != jc11Lane2 && Integer.parseInt(strs[20]) != jc11Lane3 && Integer.parseInt(strs[20]) != jc11Lane4 && Integer.parseInt(strs[20]) != jc11Lane5 && Integer.parseInt(strs[20]) != jc11Lane6) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds9.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids9 = radarIds9.get(String.valueOf(radar.getId()));
//                        System.out.println(ids9);
                            Car car = carHaveId(radar, ids9, jc1112DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc11Lane1
                            if (radar.getLane() == jc11Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1112DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc1112DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1112DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1112DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1112DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc11Lane2
                            else if (radar.getLane() == jc11Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1112DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1112DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1112DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1112DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1112DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc11Lane3
                            else if (radar.getLane() == jc11Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1134DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1134DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1134DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1134DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1134DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc11Lane4
                            else if (radar.getLane() == jc11Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1134DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1134DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1134DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1134DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1134DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc11Lane5
                            else if (radar.getLane() == jc11Lane5) {
//                            System.out.println("车道为2");
                                // car5有数据
                                if (redis.llen("car5") > 0) {
//                                System.out.println("car5还有车");
                                    while (true) {
                                        if (redis.llen("car5") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1156DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car5", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car5");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1156DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1156DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1156DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car5");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car5无数据，发送未知车辆
                                else if (redis.llen("car5") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1156DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc11Lane6
                            else if (radar.getLane() == jc11Lane6) {
//                            System.out.println("车道为2");
                                // car6有数据
                                if (redis.llen("car6") > 0) {
//                                System.out.println("car6还有车");
                                    while (true) {
                                        if (redis.llen("car6") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1156DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car6", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car6");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1156DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids9.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1156DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1156DevNo);
                                                    // 存radarId
                                                    ids9.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds9.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car6");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car6无数据，发送未知车辆
                                else if (redis.llen("car6") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1156DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1112DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1112DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1134DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1134DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car5") > 0) {
                            String carString = redis.lpop("car5");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1156DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car6") > 0) {
                            String carString = redis.lpop("car6");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1156DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids9.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids9.put(carStrs[5], carStrs[5]);
                                carIds9.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds9.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.69,jc11融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread69.start();

        Thread thread72 = new Thread(() -> {    // jc13 3.1.2.72  devNo:14,15
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(12);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc13Lane1 && Integer.parseInt(strs[20]) != jc13Lane2 && Integer.parseInt(strs[20]) != jc13Lane3 && Integer.parseInt(strs[20]) != jc13Lane4) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds12.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids12 = radarIds12.get(String.valueOf(radar.getId()));
//                        System.out.println(ids12);
                            Car car = carHaveId(radar, ids12, jc1312DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc13Lane1
                            if (radar.getLane() == jc13Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1312DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc1312DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids12.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1312DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1312DevNo);
                                                    // 存radarId
                                                    ids12.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds12.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1312DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc13Lane2
                            else if (radar.getLane() == jc13Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1312DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1312DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids12.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1312DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1312DevNo);
                                                    // 存radarId
                                                    ids12.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds12.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1312DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc13Lane3
                            else if (radar.getLane() == jc13Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1334DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1334DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids12.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1334DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1334DevNo);
                                                    // 存radarId
                                                    ids12.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds12.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1334DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc13Lane4
                            else if (radar.getLane() == jc13Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1334DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1334DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids12.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1334DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1334DevNo);
                                                    // 存radarId
                                                    ids12.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds12.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1334DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1312DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids12.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids12.put(carStrs[5], carStrs[5]);
                                carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds12.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1312DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids12.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids12.put(carStrs[5], carStrs[5]);
                                carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds12.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1334DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids12.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids12.put(carStrs[5], carStrs[5]);
                                carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds12.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1334DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids12.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids12.put(carStrs[5], carStrs[5]);
                                carIds12.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds12.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.72,jc13融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread72.start();


        Thread thread73 = new Thread(() -> {    // jc14 3.1.2.73  devNo:12,13
            try (Jedis redis = new Jedis("127.0.0.1", 6379)) {
                Gson gson = new Gson();
                while (true) {
                    redis.auth("jcgs2024");
                    redis.select(13);
//                    System.out.println("线程4正在运行中");
//                System.out.println("雷达redis长度为" + radarJedis.llen("radar"));
                    if (redis.llen("radar") > 0) {
//                        System.out.println("雷达redis长度不为0");
                        // 获取radar
                        String string = redis.lindex("radar", 0);
//                    System.out.println(string);
                        String[] strs = string.split(",");
//                        if (strs.length < 21)
//                            continue;
//                        System.out.println(string);
//                        System.out.println(strs[20]);
                        if (Integer.parseInt(strs[20]) != jc14Lane1 && Integer.parseInt(strs[20]) != jc14Lane2 && Integer.parseInt(strs[20]) != jc14Lane3 && Integer.parseInt(strs[20]) != jc14Lane4) {
//                            System.out.println("车道信息对不上");
                            redis.lpop("radar");
                            continue;
                        }
                        Radar radar = newRadar(strs);
                        radar.calTime();
//                    System.out.println(radar);
                        // 如果radarId已经存在
                        if (radarIds13.containsKey(String.valueOf(radar.getId()))) {
//                        System.out.println("radarId已经存在");
                            // 获取redarId对应的车辆信息并发送
                            Ids ids13 = radarIds13.get(String.valueOf(radar.getId()));
//                        System.out.println(ids13);
                            Car car = carHaveId(radar, ids13, jc1412DevNo);
//                            System.out.println("radarId已存在，发送车辆");
                            redis.lpop("radar");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        // radarId不存在
                        else {
//                        System.out.println("radarId不存在");
                            // lane = jc14Lane1
                            if (radar.getLane() == jc14Lane1) {
//                            System.out.println("车道为1");
                                // car1有数据
                                if (redis.llen("car1") > 0) {
//                                System.out.println("car1还有车");
                                    while (true) {
                                        if (redis.llen("car1") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1412DevNo);
//                                            System.out.println("车辆redis为空，发送未知车辆");
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car1", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car1");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
                                                Car car = newCar(radar, jc1412DevNo);
//                                                System.out.println("时间过晚，发送未知车辆");
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
                                                if (ids13.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1412DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
//                                                carJedis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1412DevNo);
                                                    // 存radarId
                                                    ids13.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds13.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car1");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car1无数据，发送未知车辆
                                else if (redis.llen("car1") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1412DevNo);
//                                    System.out.println("车辆redis为空，发送未知车辆");
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc14Lane2
                            else if (radar.getLane() == jc14Lane2) {
//                            System.out.println("车道为2");
                                // car2有数据
                                if (redis.llen("car2") > 0) {
//                                System.out.println("car2还有车");
                                    while (true) {
                                        if (redis.llen("car2") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1412DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car2", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car2");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1412DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids13.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1412DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1412DevNo);
                                                    // 存radarId
                                                    ids13.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds13.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car2");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car2无数据，发送未知车辆
                                else if (redis.llen("car2") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1412DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc14Lane3
                            else if (radar.getLane() == jc14Lane3) {
//                            System.out.println("车道为2");
                                // car3有数据
                                if (redis.llen("car3") > 0) {
//                                System.out.println("car3还有车");
                                    while (true) {
                                        if (redis.llen("car3") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1434DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car3", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car3");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1434DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids13.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1434DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1434DevNo);
                                                    // 存radarId
                                                    ids13.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds13.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car3");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car3无数据，发送未知车辆
                                else if (redis.llen("car3") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1434DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                            // lane = jc14Lane4
                            else if (radar.getLane() == jc14Lane4) {
//                            System.out.println("车道为2");
                                // car4有数据
                                if (redis.llen("car4") > 0) {
//                                System.out.println("car4还有车");
                                    while (true) {
                                        if (redis.llen("car4") <= 0) {
                                            // 如果车辆为空，则发送未知车辆
                                            Car car = newCar(radar, jc1434DevNo);
                                            redis.lpop("radar");
                                            sendJsonToLocalPort(gson.toJson(car));
                                            break;
                                        } else {
                                            String carString = redis.lindex("car4", 0);
//                                        System.out.println("车辆信息为" + carString);
                                            String[] carStrs = carString.split(",");
                                            // 车辆时间过早
                                            if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() < -SUB) {
                                                // 如果时间过早则不做处理，继续循环往后找车辆
                                                redis.lpop("car4");
//                                            System.out.println("时间过早，不做处理");
                                            } else if (new BigDecimal(carStrs[23]).subtract(radar.getTime()).intValue() > SUB) {
                                                // 如果时间过晚，则发送未知车辆，并跳出循环
//                                                System.out.println("时间过晚，发送未知车辆");
                                                Car car = newCar(radar, jc1434DevNo);
                                                redis.lpop("radar");
                                                sendJsonToLocalPort(gson.toJson(car));
                                                break;
                                            } else {
                                                // 时间对的上，则将radarId与车辆信息匹配，存起来，并发送该车辆，并跳出循环
                                                // 车牌号码已经发送过，则发送未知车辆
                                                String lpn = carStrs[5];
//                                            System.out.println("车牌是" + lpn);
                                                if (ids13.containsValue(lpn)) {
//                                                System.out.println("车牌已经用过");
                                                    Car car = newCar(radar, jc1434DevNo);
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
                                                    redis.lpop("radar");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                                // 车牌号码还未发送过，则发送该车辆，并存起来
                                                else {
//                                                System.out.println("车牌还没用过");
                                                    // 获取车辆信息
                                                    Car car = newLpn(radar, carStrs, jc1434DevNo);
                                                    // 存radarId
                                                    ids13.put(radar.getId() + "", car.getChannelInfo().getCarList().getLpn());
                                                    carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    radarIds13.put(radar.getId() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                                            car.getChannelInfo().getCarList().getID(), radar.getObjectLatitude(), radar.getObjectLongitude(), car.getChannelInfo().getCarList().getLpn(),
                                                            car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                                    // 发送车辆
//                                                    System.out.println("时间对上了，车牌没用过，发送车辆并保存车牌");
                                                    redis.lpop("radar");
                                                    redis.lpop("car4");
                                                    sendJsonToLocalPort(gson.toJson(car));
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                // car4无数据，发送未知车辆
                                else if (redis.llen("car4") <= 0) {
                                    // 发送未知车辆
                                    Car car = newCar(radar, jc1434DevNo);
                                    redis.lpop("radar");
                                    sendJsonToLocalPort(gson.toJson(car));
                                }
                            }
                        }
                    } else {
                        // 雷达为空，但是车辆不为空
                        if (redis.llen("car1") > 0) {
                            String carString = redis.lpop("car1");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1412DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids13.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids13.put(carStrs[5], carStrs[5]);
                                carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds13.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car2") > 0) {
                            String carString = redis.lpop("car2");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1412DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids13.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids13.put(carStrs[5], carStrs[5]);
                                carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds13.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car3") > 0) {
                            String carString = redis.lpop("car3");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1434DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids13.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids13.put(carStrs[5], carStrs[5]);
                                carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds13.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                        if (redis.llen("car4") > 0) {
                            String carString = redis.lpop("car4");
                            String[] carStrs = carString.split(",");
                            Car car = noRadar(carStrs, jc1434DevNo);
                            if (carStrs[5].equals("未知")) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else if (ids13.containsValue(carStrs[5])) {
                                car.getChannelInfo().getCarList().setLpn("视频");
                            } else {
                                car.getChannelInfo().getCarList().setLpn("视频" + carStrs[5]);
                                ids13.put(carStrs[5], carStrs[5]);
                                carIds13.put(car.getChannelInfo().getCarList().getID(), new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                                radarIds13.put(System.currentTimeMillis() + "", new Ids(car.getChannelInfo().getCarList().getBrand(), car.getChannelInfo().getCarList().getColor(),
                                        car.getChannelInfo().getCarList().getID(), new BigDecimal(carStrs[3]), new BigDecimal(carStrs[4]), car.getChannelInfo().getCarList().getLpn(),
                                        car.getChannelInfo().getCarList().getLpnColor(), System.currentTimeMillis()));
                            }
//                                                    System.out.println("时间对上了，但是车牌已用过，发送未知车辆");
//                            radarJedis.lpop("radar");
//                                                carJedis.lpop("car1");
                            sendJsonToLocalPort(gson.toJson(car));
                        }
                    }
                }
            } catch (Exception e) {
                LocalDateTime now = LocalDateTime.now();
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                logger.error(now.format(formatter));
                logger.error("3.1.2.73,jc14融合时出现问题");
                logger.error("msg", e);
            }

//            System.out.println("跳出循环了");
        });
        thread73.start();


        // thread1xx表示为ip为3.1.2.xx-40的雷达的融合定期清除车牌信息
        Thread thread101 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds1.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds1.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids1.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids1.remove(entry.getKey());
                                }
                            }
                            radarIds1.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds1.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids1.remove(entry.getKey());
                            carIds1.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.61,jc07清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread101.start();
        Thread thread102 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds2.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds2.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids2.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids2.remove(entry.getKey());
                                }
                            }
                            radarIds2.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds2.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids2.remove(entry.getKey());
                            carIds2.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.62,jc05清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread102.start();
        Thread thread103 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds3.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds3.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids3.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids3.remove(entry.getKey());
                                }
                            }
                            radarIds3.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds3.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids3.remove(entry.getKey());
                            carIds3.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.63,jc03清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread103.start();
        Thread thread104 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds4.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds4.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids4.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids4.remove(entry.getKey());
                                }
                            }
                            radarIds4.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds4.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids4.remove(entry.getKey());
                            carIds4.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.64,jc08清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread104.start();
        Thread thread105 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds5.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds5.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids5.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids5.remove(entry.getKey());
                                }
                            }
                            radarIds5.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds5.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids5.remove(entry.getKey());
                            carIds5.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.65,jc01清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread105.start();
        Thread thread108 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds8.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds8.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids8.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids8.remove(entry.getKey());
                                }
                            }
                            radarIds8.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds8.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids8.remove(entry.getKey());
                            carIds8.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.68,jc06清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread108.start();
        Thread thread109 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds9.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds9.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids9.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids9.remove(entry.getKey());
                                }
                            }
                            radarIds9.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds9.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids9.remove(entry.getKey());
                            carIds9.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.69,jc11清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread109.start();
        Thread thread112 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds12.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds12.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids12.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids12.remove(entry.getKey());
                                }
                            }
                            radarIds12.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds12.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids12.remove(entry.getKey());
                            carIds12.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.72,jc13清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread112.start();
        Thread thread113 = new Thread(() -> {
            while (true) {
                // 每一分钟检测一次
//                System.out.println("线程4正在运行");
                if (!radarIds13.isEmpty()) {
                    long time = System.currentTimeMillis();
                    for (Map.Entry<String, Ids> entry : radarIds13.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            String lpn = entry.getValue().getLpn();
                            for (Map.Entry<String, String> entry1 : ids13.entrySet()) {
                                if (entry1.getValue().equals(lpn)) {
                                    ids13.remove(entry.getKey());
                                }
                            }
                            radarIds13.remove(entry.getKey());
                        }
                    }
                    for (Map.Entry<String, Ids> entry : carIds13.entrySet()) {
                        if (time - entry.getValue().getTime() > sleepTime) {
                            ids13.remove(entry.getKey());
                            carIds13.remove(entry.getKey());
                        }
                    }
                }
//                System.out.println("radarIds的长度为" + radarIds.size());
//                System.out.println("carIds的长度为" + carIds.size());
//                System.out.println("ids的长度为" + ids.size());
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    LocalDateTime now = LocalDateTime.now();
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    logger.error(now.format(formatter));
                    logger.error("3.1.2.73,jc14清理车牌信息时出现问题");
                    logger.error("msg", e);
                }
            }
        });
        thread113.start();


//        // 定期发送空消息清空车道
//        Thread thread1000 = new Thread(() -> {
//            while (true) {
//                String json = "{\"MsgType\": 1000," + "\"DevNo\": \"1\"," +"\"Timestamp\": 1730773343558," + "\"ReceiveTime\": \"2024-11-05 10:22:26.202\"," + "\"Frame\": 154186," + "\"ChannelInfo\": [" + "{" + "\"ChannelId\": 1," + "\"Direction\": 1," + "\"DriveWay\": 1," + "\"Car_List\": []," + "\"People_List\": []," + "\"otherVehicle_List\": []" + "}," + "{" + "\"ChannelId\": 2," + "\"Direction\": 1," + "\"DriveWay\": 1," + "\"Car_List\": []," + "\"People_List\": []," + "\"otherVehicle_List\": []" + "}" + "]" + "}";
//                sendJsonToLocalPort(json);
////                System.out.println("radarIds的长度为" + radarIds.size());
////                System.out.println("carIds的长度为" + carIds.size());
////                System.out.println("ids的长度为" + ids.size());
//                try {
//                    Thread.sleep(10);
//                } catch (InterruptedException e) {
//                    throw new RuntimeException(e);
//                }
//            }
//        });
//        thread1000.start();

    }

    public static void sendJsonToLocalPort(String json) throws IOException {
        System.out.println(json);
//        writer.write(json + "\n");
        DatagramSocket socket = null;
        try {
            socket = new DatagramSocket();
            byte[] data = json.getBytes();
            DatagramPacket packet = new DatagramPacket(data, data.length, InetAddress.getByName("127.0.0.1"), 60000);
//            System.out.println("向sleepTime端口发送数据");
            DatagramPacket packet2 = new DatagramPacket(data, data.length, InetAddress.getByName("127.0.0.1"), 1600);
//            System.out.println("向1600端口发送数据");
            socket.send(packet);
            socket.send(packet2);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (socket != null && !socket.isClosed()) {
                socket.close();
            }
        }
        sendToMysql(json);
    }


    public static void sendToMysql(String json) {
//        System.out.println(json);
        DatagramSocket socket = null;
        try {
            socket = new DatagramSocket();
            byte[] data = json.getBytes();
            DatagramPacket packet = new DatagramPacket(data, data.length, InetAddress.getByName("3.1.2.114"), 60500);
//            System.out.println("向数据库60500端口发送数据");
            socket.send(packet);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (socket != null && !socket.isClosed()) {
                socket.close();
            }
        }
    }

    public static String toString(String jsonString) {
        jsonString = jsonString.replaceAll("\\n", ""); // 去掉换行符
        jsonString = jsonString.replaceAll("\\s+", " "); // 去掉多余的空格
        JSONObject rootObject = JSON.parseObject(jsonString);
        JSONArray channelInfoArray = rootObject.getJSONArray("ChannelInfo");

        List<String> resultList = new ArrayList<>();

        for (int i = 0; i < channelInfoArray.size(); i++) {
            JSONObject channelInfo = channelInfoArray.getJSONObject(i);
            JSONArray carListArray = channelInfo.getJSONArray("Car_List");
            String channelId = channelInfo.getString("ChannelId");
            String direction = channelInfo.getString("Direction");
            String driveWay = channelInfo.getString("DriveWay");
            Object otherVehicleList = channelInfo.get("OtherVehicle_List");
            Object peopleList = channelInfo.get("People_List");

            // 获取顶层的其他信息
            String devNo = rootObject.getString("DevNo");
            String frame = rootObject.getString("Frame");
            String msgType = rootObject.getString("MsgType");
            String timestamp = rootObject.getString("Timestamp");

            for (int j = 0; j < carListArray.size(); j++) {
                JSONObject carObject = carListArray.getJSONObject(j);
                // 提取 carObject 中的字段值
                String brand = carObject.getString("Brand");
                String color = carObject.getString("Color");
                String id = carObject.getString("ID");
                Double lat = carObject.getDouble("Lat");
                Double lon = carObject.getDouble("Lon");
                String lpn = carObject.getString("Lpn");
                String lpnColor = carObject.getString("LpnColor");
                Integer objId = carObject.getInteger("ObjId");
                Double posX = carObject.getDouble("PosX");
                Double posY = carObject.getDouble("PosY");
                Double ptcHeading = carObject.getDouble("PtcHeading");
                Double speed = carObject.getDouble("Speed");
                String type = carObject.getString("Type");
                Double vehL = carObject.getDouble("VehL");
                Integer vehType = carObject.getInteger("VehType");

                // 将 carObject 的字段值与 channelInfo 中的其他信息拼接
                String result = brand + "," + color + "," + id + "," + lat + "," + lon + "," + lpn + "," + lpnColor + "," + objId + "," + posX + "," + posY + "," + ptcHeading + "," + speed + "," + type + "," + vehL + "," + vehType + "," + channelId + "," + direction + "," + driveWay + "," + otherVehicleList + "," + peopleList + "," + devNo + "," + frame + "," + msgType + "," + timestamp;
                resultList.add(result);
            }
        }

        // 将结果列表转换为用分号分隔的字符串
        String finalResult = String.join(";", resultList);
//        System.out.println(finalResult);
        return finalResult;
    }

//    private static boolean isjson(String str) {
//        try {
//            JSONObject jsonStr = JSONObject.parseObject(str);
//            return true;
//        } catch (Exception e) {
//            return false;
//        }
//    }

    private static Radar newRadar(String[] strs) {
        Radar radar = new Radar();
        radar.setSecond(Long.parseLong(strs[0]));
        radar.setMillisecond(Integer.parseInt(strs[1]));
        radar.setId(Integer.parseInt(strs[2]));
        radar.setRoad(strs[3]);
        radar.setObjClass(strs[4]);
        radar.setObjLength(Integer.parseInt(strs[5]));
        radar.setObjWidth(Integer.parseInt(strs[6]));
        radar.setOrientationAngle(Integer.parseInt(strs[7]));
        radar.setX(Integer.parseInt(strs[8]));
        radar.setY(Integer.parseInt(strs[9]));
        radar.setxSpeed(Integer.parseInt(strs[10]));
        radar.setySpeed(Integer.parseInt(strs[11]));
        radar.setSpeed(Integer.parseInt(strs[12]));
        radar.setaSpeed(Integer.parseInt(strs[13]));
        radar.setaXSpeed(Integer.parseInt(strs[14]));
        radar.setaYSpeed(Integer.parseInt(strs[15]));
        radar.setObjectRCS(0);
        radar.setLongitude(Integer.parseInt(strs[17]));
        radar.setLatitude(Integer.parseInt(strs[18]));
        radar.setEvent(Integer.parseInt(strs[19]));
        radar.setLane(Integer.parseInt(strs[20]));
        radar.setObjectLatitude(new BigDecimal(strs[21]));
        radar.setObjectLongitude(new BigDecimal(strs[22]));
        return radar;
    }

    private static Car carHaveId(Radar radar, Ids ids, String devNo) {
        Car car = new Car();
        car.setMsgType(1000);
        car.setDevno(devNo);
        car.setTimestamp(new BigDecimal(radar.getSecond() + "" + radar.getMillisecond()));
        car.setFrame(24051);
        car.getChannelInfo().setChannelId(radar.getLane());
        car.getChannelInfo().setDirection(1);
        car.getChannelInfo().setDriveWay(1);
        car.getChannelInfo().getCarList().setID(radar.getId() + "");
        car.getChannelInfo().getCarList().setLpn(ids.getLpn());
        car.getChannelInfo().getCarList().setLpnColor(ids.getLpnColor());
        car.getChannelInfo().getCarList().setColor(ids.getColor());
        car.getChannelInfo().getCarList().setBrand(ids.getBrand());
        car.getChannelInfo().getCarList().setType("未知");
        car.getChannelInfo().getCarList().setSpeed("100.0");
        car.getChannelInfo().getCarList().setPosX("1438.0");
        car.getChannelInfo().getCarList().setPosY("274.0");
        car.getChannelInfo().getCarList().setLon(radar.getObjectLongitude() + "");
        car.getChannelInfo().getCarList().setLat(radar.getObjectLatitude() + "");
        car.getChannelInfo().getCarList().setPtcHeading((float) 55.7);
        car.getChannelInfo().getCarList().setVehType(2);
        car.getChannelInfo().getCarList().setVehl(0);
        car.getChannelInfo().getCarList().setObjId(radar.getId());
        car.getChannelInfo().getCarList().setGlobalId(radar.getId());
        car.getChannelInfo().getCarList().setCount(24);
        car.getChannelInfo().getCarList().setIsBayonetMatch(0);
        car.getChannelInfo().getCarList().setDifferLon(0);
        car.getChannelInfo().getCarList().setDifferLat(0);
        car.getChannelInfo().getCarList().setAnalogNum(67);
        return car;
    }

    private static Car newCar(Radar radar, String devNo) {
        Car car = new Car();
        car.setMsgType(1000);
        car.setDevno(devNo);
        car.setTimestamp(new BigDecimal(radar.getSecond() + "" + radar.getMillisecond()));
        car.setFrame(24051);
        car.getChannelInfo().setChannelId(radar.getLane());
        car.getChannelInfo().setDirection(1);
        car.getChannelInfo().setDriveWay(1);
        car.getChannelInfo().getCarList().setID(radar.getId() + "");
        car.getChannelInfo().getCarList().setLpn("未知");
        car.getChannelInfo().getCarList().setLpnColor("绿色");
        car.getChannelInfo().getCarList().setColor("黄色");
        car.getChannelInfo().getCarList().setBrand("福特_蒙迪欧_轿车");
        car.getChannelInfo().getCarList().setType("未知");
        car.getChannelInfo().getCarList().setSpeed("100.0");
        car.getChannelInfo().getCarList().setPosX("1438.0");
        car.getChannelInfo().getCarList().setPosY("274.0");
        car.getChannelInfo().getCarList().setLon(radar.getObjectLongitude() + "");
        car.getChannelInfo().getCarList().setLat(radar.getObjectLatitude() + "");
        car.getChannelInfo().getCarList().setPtcHeading((float) 55.7);
        car.getChannelInfo().getCarList().setVehType(2);
        car.getChannelInfo().getCarList().setVehl(0);
        car.getChannelInfo().getCarList().setObjId(radar.getId());
        car.getChannelInfo().getCarList().setGlobalId(radar.getId());
        car.getChannelInfo().getCarList().setCount(24);
        car.getChannelInfo().getCarList().setIsBayonetMatch(0);
        car.getChannelInfo().getCarList().setDifferLon(0);
        car.getChannelInfo().getCarList().setDifferLat(0);
        car.getChannelInfo().getCarList().setAnalogNum(67);
        return car;
    }

    private static Car newLpn(Radar radar, String[] carStrs, String devNo) {
        Car car = new Car();
        car.setMsgType(1000);
        car.setDevno(devNo);
        car.setTimestamp(new BigDecimal(radar.getSecond() + "" + radar.getMillisecond()));
        car.setFrame(24051);
        car.getChannelInfo().setChannelId(radar.getLane());
        car.getChannelInfo().setDirection(1);
        car.getChannelInfo().setDriveWay(1);
        car.getChannelInfo().getCarList().setID(carStrs[2]);
        car.getChannelInfo().getCarList().setLpn(carStrs[5]);
        car.getChannelInfo().getCarList().setLpnColor(carStrs[6]);
        car.getChannelInfo().getCarList().setColor(carStrs[1]);
        car.getChannelInfo().getCarList().setBrand(carStrs[0]);
        car.getChannelInfo().getCarList().setType(carStrs[12]);
        car.getChannelInfo().getCarList().setSpeed("100.0");
        car.getChannelInfo().getCarList().setPosX("1438.0");
        car.getChannelInfo().getCarList().setPosY("274.0");
        car.getChannelInfo().getCarList().setLon(radar.getObjectLongitude() + "");
        car.getChannelInfo().getCarList().setLat(radar.getObjectLatitude() + "");
        car.getChannelInfo().getCarList().setPtcHeading((float) 55.7);
        car.getChannelInfo().getCarList().setVehType(2);
        car.getChannelInfo().getCarList().setVehl(0);
        car.getChannelInfo().getCarList().setObjId(radar.getId());
        car.getChannelInfo().getCarList().setGlobalId(radar.getId());
        car.getChannelInfo().getCarList().setCount(24);
        car.getChannelInfo().getCarList().setIsBayonetMatch(0);
        car.getChannelInfo().getCarList().setDifferLon(0);
        car.getChannelInfo().getCarList().setDifferLat(0);
        car.getChannelInfo().getCarList().setAnalogNum(67);
        return car;
    }

    private static Car noRadar(String[] carStrs, String devNo) {
        Car car = new Car();
        car.setMsgType(1000);
        car.setDevno(devNo);
        car.setTimestamp(new BigDecimal(carStrs[23]));
        car.setFrame(24051);
        car.getChannelInfo().setChannelId(Integer.parseInt(carStrs[15]));
        car.getChannelInfo().setDirection(1);
        car.getChannelInfo().setDriveWay(1);
        car.getChannelInfo().getCarList().setID(carStrs[2]);
        car.getChannelInfo().getCarList().setLpnColor("绿色");
        car.getChannelInfo().getCarList().setColor("黄色");
        car.getChannelInfo().getCarList().setBrand("福特_蒙迪欧_轿车");
        car.getChannelInfo().getCarList().setType("未知");
        car.getChannelInfo().getCarList().setSpeed("100.0");
        car.getChannelInfo().getCarList().setPosX("1438.0");
        car.getChannelInfo().getCarList().setPosY("274.0");
        car.getChannelInfo().getCarList().setLon(carStrs[4]);
        car.getChannelInfo().getCarList().setLat(carStrs[3]);
        car.getChannelInfo().getCarList().setPtcHeading((float) 55.7);
        car.getChannelInfo().getCarList().setVehType(2);
        car.getChannelInfo().getCarList().setVehl(0);
        car.getChannelInfo().getCarList().setObjId(Integer.parseInt(carStrs[7]));
        car.getChannelInfo().getCarList().setGlobalId(Integer.parseInt(carStrs[7]));
        car.getChannelInfo().getCarList().setCount(24);
        car.getChannelInfo().getCarList().setIsBayonetMatch(0);
        car.getChannelInfo().getCarList().setDifferLon(0);
        car.getChannelInfo().getCarList().setDifferLat(0);
        car.getChannelInfo().getCarList().setAnalogNum(67);
        return car;
    }

}